/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package domen;

import java.io.Serializable;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Ivan Ivic
 */
public class Dolazak implements OpstiDomenskiObjekat, Serializable {
    private Date vremeDolaska;
    private int vezbacID;
    private String sifraTreninga;

    public Date getVremeDolaska() {
        return vremeDolaska;
    }

    public void setVremeDolaska(Date vremeDolaska) {
        this.vremeDolaska = vremeDolaska;
    }

    public String getSifraTreninga() {
        return sifraTreninga;
    }

    public void setSifraTreninga(String sifraTreninga) {
        this.sifraTreninga = sifraTreninga;
    }

    public int getVezbacID() {
        return vezbacID;
    }

    public void setVezbacID(int vezbacID) {
        this.vezbacID = vezbacID;
    }

    

    public String vratiNazivTabele() {
        return "TDolazak";
    }

    public String vratiNazivKoloneTabele() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public String vratiVrednostiZaInsert() {
        return getVezbacID() + ",#" + getVremeDolaska() + "#,'" + getSifraTreninga() + "'";
    }

    public String vratiUslovZaIndentifikacijuUBazi() {
        return "VezbacID=" + getVezbacID() + " AND VremeDolaska=#" + getVremeDolaska() +"#";
    }

    public String vratiJedinstveniIdentifikator() {
        return "VezbacID";
    }

    public String vratiUslovPretrage() {
        return "VezbacId=" + getVezbacID() + " AND SifraTreninga='" + getSifraTreninga() + "'";
    }

    public String postaviVrednostiAtributa() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public LinkedList<OpstiDomenskiObjekat> konvertujResultSetUListu(ResultSet rs) {
        LinkedList<OpstiDomenskiObjekat> listaDolazaka = new LinkedList<OpstiDomenskiObjekat>();
        try {
            while (rs.next()) {
                Dolazak d = new Dolazak();
                d.setVezbacID(rs.getInt(1));
                d.setVremeDolaska(rs.getDate(2));
                d.setSifraTreninga(rs.getString(3));
                listaDolazaka.add(d);
            }
        } catch (SQLException ex) {
            Logger.getLogger(Dolazak.class.getName()).log(Level.SEVERE, null, ex);
        }

        return listaDolazaka;
    }

    public String vratiNazivDodatneTabele() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public String vratiVrednostiZaInsertDodatneTabele() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public OpstiDomenskiObjekat konvertujResultSetUObjekat(ResultSet rs) {
        throw new UnsupportedOperationException("Not supported yet.");
    }    
}

